<?php

namespace Module\Controller;

use Addons\base\Site;
use houdunwang\wechat\WeChat;

class IndexController
{
       public function index()
       {
           if (isset($_GET['mo'])) {
               //跳到addons插件模块下面
               $mo = ucfirst($_GET['mo']);
               $t = ucfirst($_GET['t']);
               $ac = $_GET['ac'];
               switch ($t) {
                   //说明访问的是前端
                   case 'Site';
                       $url = "\Addons\\" . $mo . "\Site";
                       break;
                   //说明访问的是后台
                   default;
                       $url = "\Addons\\" . $mo . "\Web";
                       break;
               }
               (new $url)->$ac();
           }
       }

    /**
     * 连接微信
     */
    public  function show(){
//       与微信服务器进行验证
        (new WeChat())->valid();
//        file_put_contents('./a.php',$res);
//关注及默认消息回复
//        (new Site())->automsg();
//        关键词回复
        (new Site())->keywordsmsg();
    }

}